package com.brunobas.pontosmart.baseadapter;

import java.util.List;

import com.brunobas.pontosmart.R;
import com.brunobas.pontosmart.utils.Util;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class SimpleSpinerUmaLinhaAdapter extends AbstractBaseAdapter {

	private List<Object> listaObjs;
	
	public SimpleSpinerUmaLinhaAdapter(Context context, List<Object> listaObjs) {
		super(context);
		
		this.listaObjs = listaObjs;
	}

	@Override
	public int getCount() {

		return this.listaObjs.size();
	}

	@Override
	public Object getItem(int position) {

		return this.listaObjs.get(position);
	}

	@Override
	public long getItemId(int position) {

		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {

		LayoutInflater inflater = Util.getLayoutInflater(this.context);
		
		convertView = inflater.inflate(R.layout.layout_spinner_simples_1linha, null);
		
		TextView textView = (TextView) convertView.findViewById(R.id.text_view_spinner_simple_item);
		
		textView.setText(this.listaObjs.get(position).toString());
		
		return convertView;
	}

}
